package edu.java.homework.hw03.ipj07;

import java.util.Arrays;

public class Exer03 {

    /**
     * @param args
     */
    public static void main(String[] args) {

	String[] strArr = { "zdr", "zDr", "ysa", "ysA", "malina", "kalina",
		"asa","AbA" };

	boolean result = isDescending(strArr);
	System.out.println(Arrays.toString(strArr));
	System.out.println("\nThe order is descending ?  " + result);

    }

    public static boolean isDescending(String[] strArr) {
	// --- check -----------------------------------------------------------
	if (strArr == null) {
	    throw new IllegalArgumentException(
		    "The array of strings is null-pointed");
	}
	for (String string : strArr) {
	    if (string == null) {
		throw new IllegalArgumentException(
			"Some of the strings in the array is null-pointed");
	    }
	}
	// ---------------------------------------------------------------------
	
	boolean result=true;
	for(int i=0;i<=strArr.length-2;i++){
	    if(strArr[i].compareTo(strArr[i+1])< 0){
		result=false;
		break;
	    }
	}
	return result;
	

    }

}
